/**
 * @description 
 * @author cq
 * @Date 2021-04-13 10:28:06
 * @LastEditTime 2021-04-13 10:28:07
 * @LastEditors cq
 */

import React from 'react'
import RouterContext from "./RouterContext";


export default function Link({
  to,
  children
}) {
  const context = React.useContext(RouterContext);

  const handClick=(e)=>{
    e.preventDefault();
    context.history.push(to);
  }

  return (
    <a href={to} onClick={handClick}>{children}</a>
  )
}

